# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=acl
pkgver=2.3.1
pkgrel=4
pkgdesc="Access control list utilities"
url="https://savannah.nongnu.org/projects/acl"
arch="all"
license="LGPL-2.1-or-later AND GPL-2.0-or-later"
makedepends_host="attr-dev"
makedepends="$makedepends_host"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc libacl"
# depends on order of nftw, and requires test machine to have ACLs enabled on FS
options="!check"
source="https://download.savannah.nongnu.org/releases/acl/acl-$pkgver.tar.gz
	lfs64.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--libdir=/lib \
		--libexecdir=/usr/libexec
	make
}

package() {
	DESTDIR="$pkgdir" make install

	# fix install path of pkgconf files
	mkdir -p "$pkgdir"/usr/lib/
	mv "$pkgdir"/lib/pkgconfig "$pkgdir"/usr/lib/
}

libacl() {
	pkgdesc="Dynamic library for access control list support"
	mkdir -p "$subpkgdir"/lib
	mv "$pkgdir"/lib/libacl.so.* "$subpkgdir"/lib/
}

sha512sums="
f101e27058c959f4c412f475c3fc77a90d1ead8728701e4ce04ff08b34139d35e0e72278c9ac7622ba6054e81c0aeca066e09491b5f5666462e3866705a0e892  acl-2.3.1.tar.gz
c8e99e134217adcacd9ec4eb38c783e00eea73aab6b907fa88283b644a50aef5674d8154aba3ccda2f4ff753070da7f64469ddc8d6eaebadead6ed236c4ec5e6  lfs64.patch
"
